from libs.exception import BaseHTTPException
from flask_babel import gettext as _

class HShopNotFoundError(BaseHTTPException):
    error_code = "shop_nofound_error"
    code = 400
    def __init__(self,shop_id:str|None):
        self.description = _("Shop not found error.{message}").format(message=shop_id)
        super().__init__(self.description)

class HShopParamError(BaseHTTPException):
    error_code = "shop_param_error"
    code = 400
    def __init__(self,message:str|None):
        if message:
            self.description = _("Shop parameter error.{message}").format(message=message)
        else:
            self.description = _("Shop parameter error.")
        super().__init__(self.description)

class HProdParamError(BaseHTTPException):
    error_code = "prod_param_error"
    code = 400
    def __init__(self,message:str|None):
        if message:
            self.description = _("Product parameter error.{message}").format(message=message)
        else:
            self.description = _("Product parameter error.")
        super().__init__(self.description)

class HSKUParamError(BaseHTTPException):
    error_code = "sku_param_error"
    code = 400
    def __init__(self,message:str|None):
        if message:
            self.description = _("Product SKU parameter error.{message}").format(message=message)
        else:
            self.description = _("Product SKU parameter error.")
        super().__init__(self.description)  
class HProductNotFoundError(BaseHTTPException):
    error_code = "product_nofound_error"
    code = 400
    def __init__(self,prod_id:str|None):
        self.description = _("Product not found error.{message}").format(message=prod_id)
        super().__init__(self.description)

class HSKUNotFoundError(BaseHTTPException):
    error_code = "sku_nofound_error"
    code = 400
    def __init__(self,sku_id:str|None):
        self.description = _("Product SKU not found error.{message}").format(message=sku_id)
        super().__init__(self.description)

class HTagRefParamError(BaseHTTPException):
    error_code = "tag_ref_param_error"
    code = 400
    def __init__(self,message:str|None):
        if message:
            self.description = _("Tag reference parameter error.{message}").format(message=message)
        else:
            self.description = _("Tag reference parameter error.")
        super().__init__(self.description)

class HTagRefNotFoundError(BaseHTTPException):
    error_code = "tag_ref_nofound_error"
    code = 400
    def __init__(self,ref_id:str|None):
        self.description = _("Tag reference not found error.{message}").format(message=ref_id)
        super().__init__(self.description)
